package cn.jsj.finance.bank;

import java.io.IOException;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

/**
 * 添加一条现金支票信息处理类
 * @author LI
 *
 */
 public class AddChequeAccount extends javax.servlet.http.HttpServlet implements javax.servlet.Servlet {
	 public void service(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
		//调试信息
		 cn.jsj.utils.SysLogger.PrintInfo("添加现金支票信息！！！");

		 //获得参数
		 cn.jsj.pojo.TblCashCheque tcc=new cn.jsj.pojo.TblCashCheque();

		 tcc.setCashChequeBrief(request.getParameter("chequeBrief").trim());
		 tcc.setCashChequeTime(cn.jsj.utils.TimeDispose.transferDate(request.getParameter("chequeTime").trim()));
		 tcc.setChequeAmount(Integer.parseInt(request.getParameter("chequeAmount").trim()));
		 tcc.setCashChequePerson(request.getParameter("chequePerson").trim());
		 tcc.setChequeApplication(request.getParameter("chequeApp").trim());

		 //保存现金支票信息
		 cn.jsj.dao.TblCashChequeDAO tccd=new cn.jsj.dao.TblCashChequeDAO();
		 int saveResult=tccd.saveCashChequeInfo(tcc);

		 //调试信息
		 cn.jsj.utils.SysLogger.PrintInfo("现金支票保存结果-------->"+saveResult);

		 //输出流
		  java.io.PrintWriter out=response.getWriter();
		 //如果保存成功
		 if(saveResult==1){
			 out.println("{message:'保存成功！'}");
		 }else{
			 out.println("{message:'保存失败！'}");
		 }
		 out.flush();
		 out.close();
	}
}